//
// Created by gogoqiu on 2022/1/11.
//

#ifndef RAPIDSVN_CMAKE_MAINDIALOG_H
#define RAPIDSVN_CMAKE_MAINDIALOG_H

#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/dialog.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/listbox.h>

#include "data/PreferenceStorage.h"
#include "undefined/PreferenceScreen.h"
#include "model/MyTagApp.h"


class PreferenceAdapter;

class MainDialog : public wxFrame
{
public:
    /*
     * data update
     * objects
     * View
     * getCurrentValue
     * load the table
     * build the view items
     * dialog
     * 只有value是变化的
     */
    MainDialog( wxWindow *parent, MyTagApp * _myTagApp );
    MainDialog( MyTagApp* _myTagApp, const wxString & title, const wxLocale & locale );
    ~MainDialog() override;
private:
    MyTagApp * myTagApp;
    vector<wxPanel*> panels;
    //
    PreferenceAdapter *mPreferenceAdapter;
    void OnHello(wxCommandEvent& event);
    void OnExit(wxCommandEvent& event);
    void OnAbout(wxCommandEvent& event);
    void BuildView( );
    int idx;
    void request();
    /*
     * layout:
     *  list: sizeBox(v)
     *      panel
     *          sizeBox(v)
     *              //sizeBox(h)
     *                  title//, wxSpace, input:value
     *              statusCtrl
     */
    wxPanel *m_panel;
    //listBox sizer
    wxBoxSizer *panelRootBoxSizer;
    wxBoxSizer *dialogRootBoxSizer;
    wxScrolledWindow* m_listbox;
    //void OnClickItem(wxCommandEvent& event);
    virtual void OnClickItem( wxMouseEvent& event );

    void OnClose( wxCloseEvent&  event );

    void OnActionEvent(wxCommandEvent &event);
private:
    void startService();
    wxThread *networkMonitor;
    wxThread *postFileWorker;
    DECLARE_EVENT_TABLE()
};
enum
{
    ID_Hello = 1
};

#endif //RAPIDSVN_CMAKE_MAINDIALOG_H
